home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Basic / Visual Basic.60 / COMMON / TOOLS / VB / UNSUPPRT / CALENDAR / CALTEST.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-01-16  |  9.4 KB  |  292 lines

  1. VERSION 5.00
  2. Object = "*\AMSVBCldr.vbp"
  3. Begin VB.Form Form2 
  4.    Caption         =   "Calendar Test"
  5.    ClientHeight    =   5490
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   7950
  9.    LinkTopic       =   "Form2"
  10.    ScaleHeight     =   5490
  11.    ScaleWidth      =   7950
  12.    StartUpPosition =   2  'CenterScreen
  13.    Begin VB.Frame Frames 
  14.       Caption         =   "DayBold and DayItalic"
  15.       Height          =   855
  16.       Index           =   2
  17.       Left            =   3840
  18.       TabIndex        =   12
  19.       Top             =   1800
  20.       Width           =   3975
  21.       Begin VB.ComboBox cbxDayNum 
  22.          Height          =   315
  23.          Left            =   1260
  24.          Style           =   2  'Dropdown List
  25.          TabIndex        =   14
  26.          Top             =   360
  27.          Width           =   795
  28.       End
  29.       Begin VB.CheckBox chkDayItalic 
  30.          Caption         =   "Italic"
  31.          Height          =   255
  32.          Left            =   2520
  33.          TabIndex        =   16
  34.          Top             =   480
  35.          Width           =   1215
  36.       End
  37.       Begin VB.CheckBox chkDayBold 
  38.          Caption         =   "Bold"
  39.          Height          =   255
  40.          Left            =   2520
  41.          TabIndex        =   15
  42.          Top             =   240
  43.          Width           =   1335
  44.       End
  45.       Begin VB.Label lbl 
  46.          AutoSize        =   -1  'True
  47.          Caption         =   "Day Number:"
  48.          Height          =   195
  49.          Index           =   2
  50.          Left            =   180
  51.          TabIndex        =   13
  52.          Top             =   420
  53.          Width           =   930
  54.       End
  55.    End
  56.    Begin VB.TextBox txtValue 
  57.       Height          =   285
  58.       Left            =   3780
  59.       TabIndex        =   2
  60.       Top             =   240
  61.       Width           =   1995
  62.    End
  63.    Begin VB.CommandButton btnSetValue 
  64.       Caption         =   "Set"
  65.       Height          =   315
  66.       Left            =   5880
  67.       TabIndex        =   3
  68.       Top             =   240
  69.       Width           =   615
  70.    End
  71.    Begin VB.Frame Frames 
  72.       Caption         =   "Day Name Format"
  73.       Height          =   1095
  74.       Index           =   0
  75.       Left            =   6180
  76.       TabIndex        =   8
  77.       Top             =   600
  78.       Width           =   1575
  79.       Begin VB.OptionButton rbNameFormats 
  80.          Caption         =   "Short"
  81.          Height          =   195
  82.          Index           =   0
  83.          Left            =   120
  84.          TabIndex        =   9
  85.          Top             =   240
  86.          Width           =   1035
  87.       End
  88.       Begin VB.OptionButton rbNameFormats 
  89.          Caption         =   "Medium"
  90.          Height          =   195
  91.          Index           =   1
  92.          Left            =   120
  93.          TabIndex        =   10
  94.          Top             =   510
  95.          Width           =   1035
  96.       End
  97.       Begin VB.OptionButton rbNameFormats 
  98.          Caption         =   "Long"
  99.          Height          =   195
  100.          Index           =   2
  101.          Left            =   120
  102.          TabIndex        =   11
  103.          Top             =   780
  104.          Width           =   1035
  105.       End
  106.    End
  107.    Begin VB.Frame Frames 
  108.       Caption         =   "Navigation Options"
  109.       Height          =   1095
  110.       Index           =   1
  111.       Left            =   3780
  112.       TabIndex        =   4
  113.       Top             =   600
  114.       Width           =   2295
  115.       Begin VB.CheckBox chkMonthRO 
  116.          Caption         =   "Month Read-Only"
  117.          Height          =   195
  118.          Left            =   120
  119.          TabIndex        =   5
  120.          Top             =   240
  121.          Width           =   1815
  122.       End
  123.       Begin VB.CheckBox chkYearRO 
  124.          Caption         =   "Year Read-Only"
  125.          Height          =   195
  126.          Left            =   120
  127.          TabIndex        =   6
  128.          Top             =   540
  129.          Width           =   1815
  130.       End
  131.       Begin VB.CheckBox chkShowIterration 
  132.          Caption         =   "Show Iterration Buttons"
  133.          Height          =   195
  134.          Left            =   120
  135.          TabIndex        =   7
  136.          Top             =   840
  137.          Width           =   1995
  138.       End
  139.    End
  140.    Begin VB.ListBox lbxEvents 
  141.       Height          =   2235
  142.       Left            =   0
  143.       TabIndex        =   19
  144.       Top             =   3240
  145.       Width           =   7875
  146.    End
  147.    Begin VB.CheckBox chkShowWillChange 
  148.       Caption         =   "Show WillChangeDate Message"
  149.       Height          =   195
  150.       Left            =   3900
  151.       TabIndex        =   17
  152.       Top             =   2880
  153.       Width           =   2715
  154.    End
  155.    Begin MSVBCalendar.Calendar Calendar1 
  156.       Height          =   2895
  157.       Left            =   120
  158.       TabIndex        =   0
  159.       Top             =   120
  160.       Width           =   3495
  161.       _ExtentX        =   6165
  162.       _ExtentY        =   5106
  163.       Day             =   15
  164.       Month           =   10
  165.       Year            =   1996
  166.       BeginProperty DayNameFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  167.          Name            =   "MS Sans Serif"
  168.          Size            =   8.25
  169.          Charset         =   0
  170.          Weight          =   700
  171.          Underline       =   0   'False
  172.          Italic          =   0   'False
  173.          Strikethrough   =   0   'False
  174.       EndProperty
  175.       BeginProperty DayFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  176.          Name            =   "MS Sans Serif"
  177.          Size            =   8.25
  178.          Charset         =   0
  179.          Weight          =   400
  180.          Underline       =   0   'False
  181.          Italic          =   0   'False
  182.          Strikethrough   =   0   'False
  183.       EndProperty
  184.    End
  185.    Begin VB.Label lbl 
  186.       AutoSize        =   -1  'True
  187.       Caption         =   "Current Date (Value):"
  188.       Height          =   195
  189.       Index           =   0
  190.       Left            =   3780
  191.       TabIndex        =   1
  192.       Top             =   0
  193.       Width           =   1485
  194.    End
  195.    Begin VB.Label lbl 
  196.       AutoSize        =   -1  'True
  197.       Caption         =   "Events:"
  198.       Height          =   195
  199.       Index           =   1
  200.       Left            =   120
  201.       TabIndex        =   18
  202.       Top             =   3000
  203.       Width           =   540
  204.    End
  205. Attribute VB_Name = "Form2"
  206. Attribute VB_GlobalNameSpace = False
  207. Attribute VB_Creatable = False
  208. Attribute VB_PredeclaredId = True
  209. Attribute VB_Exposed = False
  210. Option Explicit
  211. Private m_fIgnoreEvent As Boolean
  212. Private Sub btnSetValue_Click()
  213.     Calendar1.Value = DateValue(txtValue.Text)
  214. End Sub
  215. Private Sub Calendar1_DateChange(ByVal OldDate As Date, ByVal NewDate As Date)
  216.     txtValue.Text = NewDate
  217.     AddEvent "DateChange: OldDate = " & OldDate & ", NewDate = " & NewDate
  218. End Sub
  219. Private Sub Calendar1_DblClick()
  220.     AddEvent "DblClick: Current Date = " & Calendar1.Value
  221. End Sub
  222. Private Sub Calendar1_WillChangeDate(ByVal NewDate As Date, Cancel As Boolean)
  223.     Dim sPrompt As String
  224.     AddEvent "WillChangeDate: NewDate = " & NewDate
  225.     If Me.chkShowWillChange Then
  226.         sPrompt = "Date will change from " & Calendar1.Value & " to " & NewDate & "." & vbCrLf & "Will you allow the change?"
  227.         If MsgBox(sPrompt, vbYesNo + vbQuestion, "WillChangeDate Event") = vbNo Then
  228.             AddEvent "Change Denied -- Cancel set to True in WillChange event"
  229.             Cancel = True
  230.         End If
  231.         Calendar1.Refresh
  232.     End If
  233. End Sub
  234. Private Sub cbxDayNum_Click()
  235.     m_fIgnoreEvent = True
  236.     If Calendar1.DayBold(cbxDayNum.Text) Then
  237.         chkDayBold.Value = 1
  238.     Else
  239.         chkDayBold.Value = 0
  240.     End If
  241.     If Calendar1.DayItalic(cbxDayNum.Text) Then
  242.         chkDayItalic.Value = 1
  243.     Else
  244.         chkDayItalic.Value = 0
  245.     End If
  246.     m_fIgnoreEvent = False
  247. End Sub
  248. Private Sub chkDayBold_Click()
  249.     If Not m_fIgnoreEvent Then
  250.         Calendar1.DayBold(cbxDayNum.Text) = CBool(chkDayBold.Value)
  251.         Calendar1.Refresh
  252.     End If
  253. End Sub
  254. Private Sub chkDayItalic_Click()
  255.     If Not m_fIgnoreEvent Then
  256.         Calendar1.DayItalic(cbxDayNum.Text) = CBool(chkDayItalic.Value)
  257.         Calendar1.Refresh
  258.     End If
  259. End Sub
  260. Private Sub chkMonthRO_Click()
  261.     Calendar1.MonthReadOnly = CBool(chkMonthRO.Value)
  262. End Sub
  263. Private Sub chkShowIterration_Click()
  264.     Calendar1.ShowIterrationButtons = CBool(chkShowIterration.Value)
  265. End Sub
  266. Private Sub chkYearRO_Click()
  267.     Calendar1.YearReadOnly = CBool(chkYearRO.Value)
  268. End Sub
  269. Private Sub Form_Load()
  270.     Dim nDay As Long
  271.     txtValue.Text = Calendar1.Value
  272.     rbNameFormats(Calendar1.DayNameFormat).Value = True
  273.     chkMonthRO.Value = Abs(Calendar1.MonthReadOnly)
  274.     chkYearRO.Value = Abs(Calendar1.YearReadOnly)
  275.     chkShowIterration.Value = Abs(Calendar1.ShowIterrationButtons)
  276.     Me.Caption = "Calendar Version " & Calendar1.Version
  277.     For nDay = 1 To 31
  278.         cbxDayNum.AddItem nDay
  279.     Next nDay
  280.     cbxDayNum.ListIndex = 0
  281. End Sub
  282. Private Sub rbNameFormats_Click(Index As Integer)
  283.     Calendar1.DayNameFormat = Index
  284. End Sub
  285. Private Sub AddEvent(sText As String)
  286.     If lbxEvents.ListCount > 1000 Then
  287.         lbxEvents.Clear
  288.     End If
  289.     lbxEvents.AddItem sText
  290.     lbxEvents.ListIndex = lbxEvents.NewIndex
  291. End Sub
  292.